<?php
/**
 * Created by PhpStorm.
 * Script Name: Mp.php
 * Create: 2023/3/3 15:57
 * Description:
 * Author: fudaoji<fdj@kuryun.cn>
 */

namespace plugin\wechat\app\queue;
use EasyWeChat\Kernel\Messages\Image;
use EasyWeChat\Kernel\Messages\Text;
use plugin\wechat\app\service\Mp as MpService;

class Mp
{

    public function __construct()
    {

    }

    /**
     * 客服发送消息
     * @param array $params
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
     * @throws \EasyWeChat\Kernel\Exceptions\RuntimeException
     * @throws \Psr\SimpleCache\InvalidArgumentException
     */
    public function customerServiceSend($params = []){
        $mp_info = $params['mp_info'];
        $app = MpService::getApp($mp_info);
        $content = new Image($params['content']);
        $to = $params['to'];
        $app->customer_service->message(new Text("第三条"))->to($to)->send();
        sleep(2);
        $app->customer_service->message($content)->to($to)->send();
    }
}